<template>
  <div class="">
    <div class="page-filter mb10 fl">
      <el-form ref="filter" :model="filter" label-width="0">
        <el-form-item class="mr10 mb5 fl">
          <ProFilter v-model="filter.pro_id" />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <el-input v-model="filter.nickname" placeholder="申请人" size="small" clearable />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <el-input v-model="filter.company" placeholder="公司名称" size="small" clearable />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl">
          <el-input v-model="filter.dept_name" placeholder="部门" size="small" clearable />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" prop="begin_use_time">
          <el-date-picker
            v-model="filter.begin_use_time"
            placeholder="开始时间"
            type="date"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            size="small"
            clearable
            style="width: 100%"
          />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" prop="end_use_time">
          <el-date-picker
            v-model="filter.end_use_time"
            placeholder="结束时间"
            type="date"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            size="small"
            clearable
            style="width: 100%"
          />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" style="width: 300px">
          <el-button size="small" @click="app.resetFields($refs['filter'].$parent,'filter')">清 空</el-button>
          <el-button type="primary" size="small" @click="getList">查 询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table v-loading="app.loading" class="search-table" :data="list" border 
      :summary-method="getSummaries"
      show-summary
      fit highlight-current-row style="width: 100%;">
      <el-table-column label="序号" align="center" width="56px">
        <template slot-scope="{$index}">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column label="公司名称" width="160px" prop="company" />
      <el-table-column label="部门" width="160px" prop="dept_name" />
      <el-table-column label="项目名称" width="260px" prop="pro_name" />
      <el-table-column label="PO单号" width="190px">
        <template slot-scope="{row}">
          {{ 'PO'+row.pro_id }}
        </template>
      </el-table-column>
      <el-table-column label="事由" width="260px" prop="reason" />
      <el-table-column label="申请金额" align="right" width="110px">
        <template slot-scope="{row}">
          {{ app.toFix(row.money, 2) }}
        </template>
      </el-table-column>
      <el-table-column label="使用日期" align="center" width="110px" prop="use_time" />
      <el-table-column label="归还日期" align="center" width="110px" prop="return_time" />
      <el-table-column label="申请人" width="160px" prop="nickname" />
      <el-table-column label="申请时间" align="center" width="140px" prop="apply_time" />
      <el-table-column label="备注" min-width="260px" prop="remark" />
      <!-- <el-table-column label="操作" align="center" width="90px" fixed="right">
        <template slot-scope="{row}">
          <el-dropdown>
            <el-button type="primary" size="mini">
              操作<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                @click.native="files({e_id: row.id, type: '',
                                      db_type: 'logc_finance_temporary_archives'})"
              >
                附 件
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column> -->
    </el-table>
    <pagination v-show="filter.pageAll>0" :total="filter.pageAll" :page.sync="filter.pageCurrent" :limit.sync="filter.pageNumber" @pagination="getList" />
    <Cos ref="cos" :info="dialog" />
  </div>
</template>

<script>
import { temporarys } from '@/api/finance/loan'
import ProFilter from '@/components/ProFilter'
import page from '@/utils/page'

export default {
  name: '',
  components: { ProFilter },
  extends: page,
  props: {
    reqList: {
      default: temporarys,
      type: Function
    }
  },
  data() {
    return {
      price: {}
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getListAfter(e) {
      this.price = e.summary
    },
    getSummaries() {
      const sums = []
      sums[0] = '合计'
      sums[6] = this.app.toFix(this.price.money, 2)
      return sums
    }
  }
}
</script>
